package com.itlong.cloud.wechat.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *       微信相关持久层接口
 * </desc>
 *
 * @createDate 2019/04/26
 */
@Mapper
@Repository
public interface IWeChatDao {

    /**
     * <desc>
     *      获取访客预约相关发送模板消息所需信息
     * </desc>
     *
     * @param passId 通行密码记录id
     * @return 访客预约相关发送模板消息所需信息
     * @author wangzhi
     * @createDate 2019/04/26
     */
    Map<String,Object> getAppVisitorPassCodeByPassId(@Param("passId") String passId);

    /**
     * <desc>
     *      获取用户微信公众号openId
     * </desc>
     *
     * @param userId 用户id
     * @return 用户微信公众号openId
     * @author wangzhi
     * @createDate 2019/05/15
     */
    String getOfficialOpenIdByUserId(@Param("userId") String userId);

    /**
     * <desc>
     *      检测wechat unionId是否存在
     * </desc>
     *
     * @param unionId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/05/20
     */
    String checkUnionIdIsExists(@Param("unionId") String unionId);

    /**
     * <desc>
     *      保存数据
     * </desc>
     *
     * @param
     * @return
     * @author cuiduanwu
     * @createDate 2017/09/25
     */
    Integer save(Map<String, Object> params);

    /**
     * <desc>
     *      更新已存在unionId的wxOpenId
     * </desc>
     *
     * @param userOpenId
     * @param wxOpenId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/05/20
     */
    Integer updateWxOpenId(@Param("userOpenId") String userOpenId,@Param("wxOpenId") String wxOpenId,@Param("nickName") String nickName);

    /**
     * <desc>
     *      获取已存在的openId
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2019/05/21
     */
    List<String> getExistsOpenIds();
}
